#include "Fixture.h"
#include "Test.h"

BEGIN_TEST(test1, "Allocating large pools of integers");
		BEGIN_CASCADE_TEST_ASSERT();
		
		const int nbInts = 44*1024*1024;
		int *hugeIntArr = (int*)malloc(sizeof(int)*nbInts);
		CASCADE_TEST_ASSERT( hugeIntArr, "Unable to malloc huge chunk of integers" );
		for(int ii=0; ii<nbInts; ++ii) {
			hugeIntArr[ii] = ii;
			CASCADE_TEST_ASSERT( hugeIntArr[ii] == ii, "Assignment to allocated memory failed" );
		} 
		
		END_CASCADE_TEST_ASSERT();
END_TEST();

AUTO_TEST_TABLE_BEGIN()
	AUTO_TEST_TABLE_ENTRY(new test1)
AUTO_TEST_TABLE_END();


#if 0
int main ( )
{
	test1 tst;
	Fixture f;
	f.AddTest( &tst );
	std::vector<TestResult> results;
	
	for(int ii=0; ii<15; ++ii) {
		results = f.RunAllTests();
		for(unsigned int ii=0; ii<results.size(); ++ii) {
			printf("%s : %s\n", results[ii].GetTestName().c_str(), results[ii].GetTestMessage().c_str());
		}
	}
	
	return 0;
}
#endif